package com.ruoyi.yey.feedback;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.yey.feedback.model.FeedBackSearchModel;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service
public class FeedBackService extends ServiceImpl<FeedBackMapper, FeedBackEntity> {
    /**
     * 分页+模糊查询
     * @param page
     * @param searchModel
     * @return
     */
    public Page<Map> findAllByPage(Page page, FeedBackSearchModel searchModel) {
        return baseMapper.findBySearchVo(page,searchModel);
    }

    /**
     * 新增操作
     * @param feedBackEntity
     */
    @Transactional(rollbackFor = Exception.class)
    public void add(FeedBackEntity feedBackEntity) {
        baseMapper.insert(feedBackEntity);
    }

    public FeedBackEntity findById(int id){
        return  baseMapper.selectById(id);
    }
}
